package com.xuecheng.content.feignclient;

import com.xuecheng.content.model.po.CourseIndex;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author hjh
 * @Description TODO
 * @since 2023/5/12
 */

@Slf4j
@Component
public class SearchServiceClientFallbackFactory implements FallbackFactory<SearchServiceClient> {
	
	@Override
	public SearchServiceClient create(Throwable throwable) {
		return new SearchServiceClient() {
			@Override
			public Boolean add(CourseIndex courseIndex) {
				throwable.printStackTrace();
				log.debug("调用搜索发生熔断走降级方法,熔断异常:", throwable.getMessage());
				return false;
			}
		};
	}
}
